package in.muton.edushare.schedules;

import in.muton.edushare.EduShareSession;

import java.io.Serializable;

import org.apache.wicket.model.IModel;

import com.edushare.common.dao.ScheduleDAO;
import com.edushare.common.vo.Schedules;

public class DeleteSchedule implements Serializable {
	private static final long serialVersionUID = -7603412246501643531L;

	public DeleteSchedule(IModel<Schedules> sch) {
		this.schedule = sch;
	}

	public void delete() {
		schedule.getObject().setStatus(Schedules.EVENT_STATUS_CANCELLED);
		ScheduleDAO schDAO = new ScheduleDAO(EduShareSession.get()
				.getSessionORMInterface());
		schDAO.updateNotifications(schedule.getObject());
		schDAO.commit();
	}

	private IModel<Schedules> schedule;
}
